<!DOCTYPE html>
<html lang="en">
  <head>
    <title>网络拓扑图</title>
    <script
      type="text/javascript"
      src="https://visjs.github.io/vis-network/standalone/umd/vis-network.min.js"
    ></script>
  
  <!-- 
    如果上述js无法加载，请改用此地址加载
    <script type="text/javascript" src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"></script>
  -->
    <style type="text/css">
      #mynetwork {
        width: 600px;
        height: 400px;
        border: 1px solid lightgray;
      }

      p {
        max-width: 600px;
      }
    </style>
  </head>
  <body>
    <div id="mynetwork"></div>

    <script type="text/javascript">
      // 创建节点数组
      var nodes = new vis.DataSet([
        { id: 1, label: "Node 1" ,fixed:true,image:"https://s11.ax1x.com/2022/03/22/qMuYbq.jpg",shape: "image"},
        { id: 2, label: "Node 2" ,fixed:true,image:"https://s11.ax1x.com/2022/03/22/qMMzbn.jpg",shape: "image"},
        { id: 3, label: "Node 3" ,fixed:true,image:"https://s11.ax1x.com/2022/03/22/qMQebR.jpg",shape: "image"},
        { id: 4, label: "Node 4" ,fixed:true,image:"https://s11.ax1x.com/2022/03/22/qMQC5V.jpg",shape: "image"},
        { id: 5, label: "Node 5" ,fixed:true,image:"https://s11.ax1x.com/2022/03/22/qMQAv4.jpg",shape: "image"},
      ]);

      // 创建一个有边的数组
      var edges = new vis.DataSet([
        { from: 1, to: 2},
        { from: 2, to: 3 },
        { from: 2, to: 4 },
        { from: 2, to: 5 },
      ]);

      // 创建网络
      var container = document.getElementById("mynetwork");
      var data = {
        nodes: nodes,
        edges: edges,
      };
      var options = { layout: { hierarchical: true} };
      var network = new vis.Network(container, data, options);
    </script>
  </body>
</html>


